//重载求最大值
import java.util.Scanner;
public class Test_2 {
    public static void main(String[] args) {
        Scanner sui = new Scanner(System.in);
        System.out.println("取最大值");
        System.out.println("请输入两个整数");
        int a = sui.nextInt();
        int b = sui.nextInt();
        int c = max(a,b);
        System.out.println(c+"是两个整数的最大值");
        System.out.println("请输入三个小数");
        double d = sui.nextDouble();
        double e = sui.nextDouble();
        double f = sui.nextDouble();
        double g = max(d,e,f);
        System.out.println(g+"是三个小数的最大值");
    }
    public static int max(int a,int b) {

        return Math.max(a,b);
    }
    public static double max(double a,double b,double c) {
        return Math.max(a,Math.max(b,c));
    }
}
/*
//求和的重载
import java.util.Scanner;
public class Test_2 {
    public static void main(String[] args) {
        Scanner sui = new Scanner(System.in);
        System.out.println("求和");
        System.out.println("请输入两个整数");
        int a = sui.nextInt();
        int b = sui.nextInt();
        int c = Add(a,b);
        System.out.println(c+"是两个整数的最大值");
        System.out.println("请输入三个小数");
        double d = sui.nextDouble();
        double e = sui.nextDouble();
        double f = sui.nextDouble();
        double g = Add(d,e,f);
        System.out.println(g+"是三个小数的最大值");
    }
    public static int Add(int a,int b) {
        return a+b;
    }
    public static double Add(double a,double b,double c) {
        return a+b+c;
    }
}*/




/*
//斐波那契数列
import java.util.Scanner;
public class Test_2 {
    public static void main(String[] args) {
        Scanner sui = new Scanner(System.in);
        int n = fibonacci(sui.nextInt());
        System.out.println(n+"");
    }
    public static int fibonacci(int n) {
        if (n == 1 || n == 2) {
            return 1;
        } else if (n > 2) {
            return fibonacci(n-1) + fibonacci(n-2);
        }else {
            System.out.println("输入错误");
            return -1;
        }
    }
}*/



/*
//使用函数求最大值
//创建方法求两个数的最大值max2，随后再写一个求3个数的最大值的函数max3。
//要求：在max3这个函数中，调用max2函数，来实现3个数的最大值计算
import java.util.Scanner;
public class Test_2 {
    public static void main(String[] args) {
        Scanner sui = new Scanner(System.in);
            int n = sui.nextInt();
            int m = sui.nextInt();
            int z = sui.nextInt();
            int a = max2(n,m);
            int b =max3(n,m,z);
        System.out.println(a+"是前两个数的最大值");
        System.out.println(b+"是三个数的最大值");
    }
    public static int max2(int a,int b) {
        return Math.max(a,b);
    }
    public static int max3(int a,int b,int c) {
        return Math.max(Math.max(a,b),c);
    }
}*/



/*
//模拟登陆
import java.util.Scanner;
public class Test_2 {
    public static void main(String[] args) {
        Scanner sui = new Scanner(System.in);
            String password = "abcdefg";
            int count = 1;
            while((count++)<=3){
                String n = sui.nextLine();
                if(password.equals(n)){
                    System.out.println("登陆成功");
                    count = 1;
                    return;
                }else {
                    System.out.println("请重新输入密码:");
                }
            }
            System.out.println("退出程序");
    }
}*/
/*
//输出一个整数的每一位
import java.util.Scanner;
public class Test_2 {
    public static void main(String[] args) {
        Scanner sui = new Scanner(System.in);
        while(sui.hasNext()){
            int tmp = sui.nextInt();
            while(tmp!=0){
                System.out.print((tmp%10)+" ");
                tmp /= 10;
            }
        }
    }
}
*/

/*
//计算分数的值
import java.util.Scanner;
public class Test_2 {
  public static void main(String[] args) {
        Scanner sui = new Scanner(System.in);
        while(sui.hasNext()){
            int n = sui.nextInt();
            float num = 0;
            int a= 0;
            for(float i = 1;i <= n;i++){
                num += Math.pow(-1 , a)*(((float)1) / i);
                a++;
            }
            System.out.println(""+num);
        }
  }
}*/






/*
打印 X 图形
public class Test_2 {
    public static void main(String[] args) {
        Scanner sui = new Scanner(System.in);
        while(sui.hasNext()){
            int n = sui.nextInt();
            for(int i = 0 ;i < n;i++){
                for(int j = 0;j < n;j++){
                    if((i == j)||(i + j == n - 1)){
                        System.out.print("*");
                    } else {
                        System.out.print(" ");
                    }
                }
                System.out.println();
            }
        }
    }
}*/
